interface Product {
  productName: string;
  productNumber: number;
  points: number;
}

interface IPersonalNotification {
  pointsHistoryId: string;
  userDingId: string;
  points: number;
}

interface IPersonalConsumeNotification extends IPersonalNotification, Product {
  userDingId: string;
  pointsHistoryId: string;
}

interface IGroupNotification extends Product {
  userName: string;
  result: string;
  orderNo: string;
}

export class DingNotificationGroupEvent {
  static key = 'ding.notification.group';
  productName: string;
  productNumber: number;
  points: number;
  userName: string;
  result: string;
  orderNo: string;
  constructor(config: IGroupNotification) {
    this.productName = config.productName;
    this.productNumber = config.productNumber;
    this.points = config.points;
    this.userName = config.userName;
    this.result = config.result;
    this.orderNo = config.orderNo;
  }
}

export class DingNotificationPersonalEvent {
  static key = 'ding.notification.personal';
  pointsHistoryId: string;
  userDingId: string;
  productName: string;
  productNumber: number;
  points: number;
  constructor(config: IPersonalConsumeNotification) {
    this.pointsHistoryId = config.pointsHistoryId;
    this.userDingId = config.userDingId;
    this.productName = config.productName;
    this.productNumber = config.productNumber;
    this.points = config.points;
  }
}

export class DingNotificationErrorEvent {
  static key = 'ding.notification.error';
  name: string;
  message: string;

  constructor(config: { name: string; message: string }) {
    this.name = config.name;
    this.message = config.message;
  }
}

interface IPersonalPointsNotification extends IPersonalNotification {
  desc: string;
  addPoints: number;
}
export class DingNotificationPersonalPointsEvent {
  static key = 'ding.notification.personalPoints';
  pointsHistoryId: string;
  userDingId: string;
  addPoints: number;
  points: number;
  desc: string;
  constructor(config: IPersonalPointsNotification) {
    this.pointsHistoryId = config.pointsHistoryId;
    this.userDingId = config.userDingId;
    this.addPoints = config.addPoints;
    this.points = config.points;
    this.desc = config.desc;
  }
}
